<style>
    .layui-form-item .layui-input-company {
        width: auto;
        padding-right: 10px;
        line-height: 38px;
    }
</style>
<form>
<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main">
        <div class="layui-form layuimini-form" lay-filter="setting">
            <div class="layui-form-item">
                <label class="layui-form-label ">设备名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" lay-verify="required" disabled class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">主机标识</label>
                <div class="layui-input-block">
                    <input type="text" name="id" lay-verify="required" lay-reqtext="唯一识别编码不能为空" placeholder="请设备唯一识别编码" value="" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">管理单位</label>
                <div class="layui-input-block">
                    <input type="text" name="maintenancer" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">责&nbsp;&nbsp;任&nbsp;&nbsp;人</label>
                <div class="layui-input-block">
                    <input type="text" name="manager" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">联系手机</label>
                <div class="layui-input-block">
                    <input type="text" name="mobile" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">联系邮箱</label>
                <div class="layui-input-block">
                    <input type="text" name="email" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="setting">保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
</form>
<script>
    layui.use(['form'], function() {
        var form = layui.form,
            $ = layui.jquery,
            layer = layui.layer;


        $.ajax({
            url: '/xapi/sysconfig',
            type: "GET",
            success: function(data) {
               // data = JSON.parse(data);
                data && form.val("setting", {
                    name: data.name,
                    id: data.id,
                    manager: data.manager,
                    mobile: data.mobile,
                    maintenancer: data.maintenancer,
                    email: data.email
                });
            },
        });
        form.render();
        form.on('submit(setting)', function(data) {
            $.ajax({
                url: '/xapi/sysconfig',
                type: "POST",
				dataType:"json",
                data: JSON.stringify(data.field),
 				headers : {'Content-Type' : 'application/json;charset=utf-8'}, 
                success: function(data) {
                    if (data.code === 0) {
                        layer.msg(data.desc, {
                            icon: 1
                        });
                    }
                },
            });
            return false;
        });

    });
</script>